package com.starhub.service.impl;

import java.util.List;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.starhub.dao.TileDao;
import com.starhub.entity.Tile;
import com.starhub.service.TileService;

@RestController
public class TileServiceImpl implements TileService {

	private TileDao tileDao;
	
	@RequestMapping(value = "getTiles")
	public List<Tile> getTiles(@RequestParam(value = "categoryId") int categoryId) {
		return tileDao.getTiles(categoryId);
	}
	
	@RequestMapping(value = "updateTile")
	public void updateTile(@RequestBody Tile tile) {
		this.tileDao.updateTile(tile);
	}
	
	@RequestMapping(value = "getTileDetails")
	public Tile getTileDetails(@RequestParam(value = "tileId") int tileId) {
		return tileDao.getTileDetails(tileId);
	}

	public void setTileDao(TileDao tileDao) {
		this.tileDao = tileDao;
	}
}
